package cn.topevery.garden.dal.dao.impl;

import cn.topevery.garden.dal.dao.ChargingPileRecordDao;
import cn.topevery.garden.entity.po.ChargingPileRecord;
import cn.topevery.garden.entity.query.ChargingPileRecordQuery;
import cn.topevery.garden.framework.base.BaseDaoImpl;
import hw.topevery.framework.db.entity.DataPager;
import hw.topevery.framework.db.entity.SqlQueryMate;
import hw.topevery.framework.db.enums.ScriptConditionEnum;
import hw.topevery.framework.entity.DbCsp;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 
 *
 * @author code-generate
 * @date 2021-08-06
 */
@Repository
public class ChargingPileRecordDaoImpl extends BaseDaoImpl<ChargingPileRecord> implements ChargingPileRecordDao {
    @Override
    public <P extends DbCsp> List<ChargingPileRecord> getSearch(P para) {
        return null;
    }

    

    @Override
    public DataPager<ChargingPileRecord> listPage(ChargingPileRecordQuery query) {
        String table = "t_charging_pile_record tcpr";

        String columns = "tcpr.*";
		int pageIndex = query.pageIndex - 1;
        int pageSize = query.pageSize;

        SqlQueryMate sqlQueryMate = new SqlQueryMate(table).setColumns(columns).setOrderBy("tcpr.c_id desc");
        sqlQueryMate
                .where(true, "tcpr.c_db_status", ScriptConditionEnum.Eq, 0)
        ;

        return getDataPager(sqlQueryMate, pageSize, pageIndex, ChargingPileRecord.class);
    }


}
